const Rooms = require('./rooms')
const Users = require('./users')
const Connections = require('./connections')

module.exports = (DAO, K) => {
    const dao = new DAO(K)
    return {
        users: new Users(dao),
        rooms: new Rooms(dao),
        dao,
        async disconn (socket) {
            let user = this.users.find({sid: socket.id})
            this.users.remove(user)
            this.rooms.removeUser(user)
        }
        //connections: new Connections (dao),
    }
}
